<?php
/**
 * Created by 云中有鹿.
 * User: 陈云
 * Blog: http://blog.likecy.cn
 * Date: 2019-04-05
 * Time: 19:38
 */

namespace app\car\controller;
use app\car\model\Driver;
use app\car\model\Task;
use app\common\controller\Api;
use think\Db;

class index extends  CarApiBase
{


    protected $noNeedLogin =['*'];
    public function getTask()
    {
//          $dir=  Task::with('info')->where('status','1')->select();
//$dir =Task::getTask();
       $dir=Driver::where('id','in','1')->select();
//        return $this->success('success',$dir);

        foreach ($dir as $row) {

//                $row->getRelation('user')->visible(['username','mobile','birthday']);
            $row['uid'] = Db::name('user')->where('id',$row['uid'])->find()['username'];
//        $row['uid'] = $row->getRelation('user')->visible(['username','mobile','birthday'])['username'];
        }
        $list = collection($dir)->toArray();


        $result = array("rows" => $list);
        return json($result);
    }





    public function test(){

        $list = \app\admin\model\car\Driver::with(['user'])
            ->where('workstatus','=','1')
//                ->where($where)
//                ->order($sort, $order)
//                ->limit
//($offset, $limit)
            ->select();

        return $this->success('200',$list);

    }

}